<p class="Paragraph">For forms with database links, the associated database is defined in the <help:link Id="65960" xmlns:help="http://openoffice.org/2000/help">Form Properties</help:link>. You will find the functions for this on the <help:link Id="65955" xmlns:help="http://openoffice.org/2000/help"><span class="T1">Data</span></help:link> tab.</p>
</span></th></tr></table>
<p class="Paragraph">The possible settings of the <span class="T1">Data</span> tab of a control depend on the respective control. You will only see the options that make sense for the current control. There are the following fields on this tab:</p>
<p class="Paragraph"><help:help-text value="hide" xmlns:help="http://openoffice.org/2000/help">Enter here the table form field to which the data content of the control field should refer to.</help:help-text> With database forms you can relate single control fields with the data fields.</p>
<p class="Paragraph">There are the following possibilities.</p>
<ul class="L1">
<li class="">
<p class="P2">1st Case: There is only one table in the form.</p>
</li>
<li class="">
<p class="P2">Under <span class="T1">Data Field</span>, you specify the field of the form table whose contents you want to be displayed.</p>
</li>
<li class="">
<p class="P2">2nd Case: The control belongs to a subform that is created by an SQL query.</p>
</li>
<li class="">
<p class="P2">Under <span class="T1">Data Field</span>, you specify the field of the SQL statement whose contents you want to be displayed.</p>
</li>
</ul>
<ul class="L2">
<li class="">
<p class="P3">3rd Case (only in the case of<help:link Id="65956" Eid="kombinationsfelder" xmlns:help="http://openoffice.org/2000/help">List Boxes</help:link>):</p>
</li>
<li class="">
<p class="P3">For combo boxes, the field of the current form table in which the values entered or selected by the user should be stored is specified under <span class="T1">Data Field</span>. (The values displayed in the list of the combo box are based on an SQL statement which is entered under <span class="T1">List Contents</span>.)</p>
</li>
<li class="">
<p class="P3">4th Case (only in the case of<help:link Id="65956" Eid="listenfelder" xmlns:help="http://openoffice.org/2000/help">List Boxes</help:link>): The form table does not contain the data to be displayed but rather a table linked to the form table through a common data field.</p>
</li>
<li class="">
<p class="P3">If you want a list field to display data from a table that is linked to the current form table, specify the field of the form table that the file content of the list field refers to or the database field that controls the display of the data in the form under <span class="T1">Data Field</span>. This data field provides the link to the other table if both tables can be linked through a common data field. It is usually a data field in which unique identification numbers are stored. (The data field whose contents is to be displayed in the form is specified by an SQL statement under <span class="T1">List Contents</span>.)</p>
</li>
</ul>
<p class="Paragraph">List boxes work with references. They can either be implemented with linked tables by SQL statements (4th Case) or through value lists:</p>
<p class="Paragraph">If you want a list field to display data of a database table that is linked to the table on which the form is based by a common data field, the link field of the form table is specified under <span class="T1">Data Field</span>.</p>
<p class="Paragraph">The link is done with a SQL Select, which, in the case of the selected option "SQL" or "Native SQL", is specified under <span class="T1">Type of List Contents</span> in the field <span class="T1">List Contents</span>. If customer names (managed in the "Customer" table) are to be displayed in the form (associated table: "Order"), the SQL statement can read as follows:</p>
<p class="Paragraph">SELECT CustomerName, CustomorNo FROM Customers,</p>
<p class="Paragraph">where "CustomerName" is the data field from the linked table "Customers" and "CustomerNo" is the field of the table "Customers" that is linked to the field of the form table specified under <span class="T1">Data Field</span>.</p>
<p class="Paragraph"><a name="referenzenwerteliste"/><span class="T1">References Using Value Lists</span></p>
<p class="Paragraph">For list boxes, you can use value lists. Value lists are lists that define reference values. This way, the control in the form does not directly display the content of a database field but rather values assigned in the value list.</p>
<p class="Paragraph">If you work with reference values of a value list, you do not see the contents of the data field that you specified under <span class="T1">Data Field</span> in the form but rather the assigned values: If you chose the "Value List" option on the <span class="T1">Data</span> tab under <span class="T1">Type of List Contents</span> and assigned a reference value to the visible list entries in the form under <span class="T1">List Contents</span> (which you enter in the <help:link Id="65921" Eid="listeneintraege" xmlns:help="http://openoffice.org/2000/help"><span class="T1">General</span></help:link> tab), then the reference values are compared with the data content of the given data field. If a reference value corresponds to the content of a data field, the associated list entries are displayed in the form.</p>
<p class="Paragraph"><help:help-text value="hide" xmlns:help="http://openoffice.org/2000/help">Using an index, specify here the table field or table SQL query linked to the field (provided under <span class="T1">Field name</span>). The possible values are 0, 1, 2, 3, etc.</help:help-text></p>
<p class="Paragraph">This property for list fields defines which data field of a linked table is displayed in the form.</p>
<p class="Paragraph">If a list box in the form is to display contents of a table linked to the form table, then define in the <span class="T1">Type of List Contents</span> field if the display is determined by an SQL command or the (linked) table is accessed. With the <span class="T1">Bound Column</span> property, you use an index to specify to which data field of the query or of the table the list field is linked. Possible values are 0, 1, 2, 3, etc.</p>
<p class="Paragraph">The property <span class="T1">Bound Column</span> makes only sense for forms that are used to access more than one table. If the form is based on only one table, the field to be displayed in the form is specified directly under <span class="T1">Data Field</span>. However, if you want the list field to display data of a table that is linked to the current table over a common data field, the linked data field is defined by the property <span class="T1">Bound Column</span>.</p>
</span></th></tr></table>
<p class="Paragraph"/>
<p class="Paragraph">If you selected the "SQL" option under <span class="T1">Type of List Contents</span>, for example, the SQL command determines the index to be specified. Example: If an SQL command of the "SELECT Field1, Field2 FROM tablename" form is specified under <span class="T1">List Content</span>, it is:</p>
<p class="Paragraph">The database field "Field2" is linked to the field specified under <span class="T1">Data field</span>.</p>
</span></td></tr></table>
<p class="Paragraph"/>
<p class="Paragraph">If you selected the "Table" option under <span class="T1">Type of List Contents</span>, the table structure defines the index to be specified. Example: If a database table is selected under <span class="T1">List Contents</span>, it is:</p>
<p class="Paragraph">The 3rd column of the table is linked to the field specified under <span class="T1">data field</span>.</p>
</span></td></tr></table>
<p class="Paragraph"/>
<p class="Head2"><help:help-id value="HID_PROP_LISTSOURCETYPE" xmlns:help="http://openoffice.org/2000/help"/>Type of list contents</p>
<p class="Paragraph"><help:help-text value="hide" xmlns:help="http://openoffice.org/2000/help">Determine here the data to fill the list.</help:help-text> With lists and combo boxes determine through the list content type, the data to fill the list.</p>
<p class="Paragraph">With the "Value List" option, all entries you entered in the <span class="T1">List Entries</span> field of the <help:link Id="65921" xmlns:help="http://openoffice.org/2000/help"><span class="T1">General</span></help:link> tab appear in the control. For database forms, you can use reference values (<help:link Id="65983" Eid="referenzenwerteliste" xmlns:help="http://openoffice.org/2000/help">see above</help:link>).</p>
<p class="Paragraph">If the content of the control is read from a database, you can determine the type of the data source with the other options. For example, you can choose between tables and queries here.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">With database forms, specify here the data source for the list content of the form-element. This field can be used to define a value list for documents without a database connection.</help:help-text></p>
<p class="Paragraph">In the case of database forms, the data source determines the entries of the list or combo box. Depending on the selected type, e.g. table or query, you have the choice between different data sources under <span class="T1">List Contents</span>, provided that these objects exist in your database. All available database objects of the type selected under <span class="T1">Type of List Contents</span> are offered here. If you have selected the "Value List" option as the type, you can use references for database forms (<help:link Id="65983" Eid="referenzenwerteliste" xmlns:help="http://openoffice.org/2000/help">see above</help:link>). If the display of the control is controlled by an SQL command, the SQL statement is entered here.</p>
<p class="Paragraph">Examples of SQL statements:</p>
<p class="Paragraph">For list boxes, an SQL statement may have the form</p>
<p class="Paragraph">SELECT field1, field2 FROM table,</p>
<p class="Paragraph">where, "table" is the table whose data is displayed in the list of the control (list table). "field1" is the data field that defines the visible entries in the form; its content is displayed in the list box. "field2" is the field of the list table that is linked to the form table (value table) through the field specified under <span class="T1">Data Field</span> if <span class="T1">Bound Column</span> = 1 was selected.</p>
<p class="Paragraph">For combo boxes, an SQL statement may take the form</p>
<p class="Paragraph">SELECT DISTINCT field FROM table,</p>
<p class="Paragraph">where "field" is a data field from the list table "table" whose content is displayed in the list of the combo box, i.e., the data field that defines the visible entries in the form.</p>
<p class="P4">Value lists for HTML documents</p>
<p class="Paragraph">For HTML forms, you can enter a value list under <span class="T1">List Contents</span>. For this purpose, select the option "Value List" under <span class="T1">Type of List Contents</span>. The values entered here will not be visible in the form and are used to assign values to the different entries visible in the form, which are transmitted in a data transfer for example. The entries made under <span class="T1">List Contents</span> correspond to the HTML tag <OPTION VALUE=...>.</p>
<p class="Paragraph">In the data transfer of a selected entry from a list or a combo box, both the list of the values displayed in the form, which was entered on the <help:link Id="65921" xmlns:help="http://openoffice.org/2000/help"><span class="T1">General</span></help:link> tab under <span class="T1">List Entries</span>, and the value list entered on the <span class="T1">Data</span> tab under <span class="T1">List Contents</span> are taken into consideration: If a (non-empty) text is at the selected position in the value list (<OPTION VALUE=...>), it will be transmitted; otherwise, the text displayed in the (<OPTION>) control is sent.</p>
<p class="Paragraph">If the value list is to contain an empty string, which is to be taken in a data transfer for example, enter the value "$$$empty$$$" under <span class="T1">List Contents</span> at the corresponding position (note uppercase/lowercase). <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> interprets this input as an empty string and assigns it to the respective list entry.</p>
<p class="Paragraph">The following table shows the connections between HTML, JavaScript, and the <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> field <span class="T1">List Contents</span> with a list field named "ListBox1". In this case, "Item" designates a list entry visible in the form:</p>
<p class="Head2"><help:help-id value="HID_PROP_EMPTY_IS_NULL" xmlns:help="http://openoffice.org/2000/help"/>Empty string is NULL</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help"> You can determine here how an empty string should be considered.</help:help-text> If this property is set (Yes), a string with one or more spaces will be interpreted as a NULL value and set on the database. If this property is not set (No), the string will be treated as an empty value.</p>
<p class="Paragraph"><help:to-be-embedded Eid="filtervorschlag" xmlns:help="http://openoffice.org/2000/help"><help:help-text value="visible">While designing your form, you can set the "<help:key-word value="Filter proposal" tag="kw65983_1"/>Filter proposal" property for each text box in the <span style="font-weight:bold;">Data</span> tab of the corresponding Properties dialog.</help:help-text> These fields allow you in a subsequent search in the filter mode, to select in a combo box all the summarized information contained in such fields. The field contents can also be easily selected using the AutoComplete function. Please note however, that this function requires a lot of memory space especially when used in large databases and should, therefore, be used sparingly.</help:to-be-embedded></p>